import Vue from 'vue'
import Router from 'vue-router'
import HelloWorld from '@/pages/HelloWorld'
// import ProductDetail from '@/pages/ProductDetail'
const Home =resolve => require(['@/pages/Home'],resolve);
const ProductDetail =resolve => require(['@/pages/ProductDetail'],resolve);
const AffirmOrder =resolve => require(['@/pages/AffirmOrder'],resolve);
const Select =resolve => require(['@/pages/Select'],resolve);
const SelectDep =resolve => require(['@/pages/SelectDep'],resolve);
const SearchDep =resolve => require(['@/pages/SearchDep'],resolve);
const RiskAnnounce =resolve => require(['@/pages/RiskAnnounce'],resolve);
const RiskMatch =resolve => require(['@/pages/RiskMatch'],resolve);
const ProductDeal =resolve => require(['@/pages/ProductDeal'],resolve);

const MyOrder =resolve => require(['@/pages/MyOrder'],resolve);
const OrderDetail =resolve => require(['@/pages/OrderDetail'],resolve);
const Modify =resolve => require(['@/pages/Modify'],resolve);
const NewsList =resolve => require(['@/pages/NewsList'],resolve);
const Success =resolve => require(['@/pages/Success'],resolve);
const Fail =resolve => require(['@/pages/Fail'],resolve);
const Refresh =resolve => require(['@/pages/Refresh'],resolve);

const Info =resolve => require(['@/components/Info'],resolve);

Vue.use(Router)

export default new Router({
  mode: 'history',
  routes: [
    {
      path: '/',
      name: 'HelloWorld',
      component: HelloWorld,
      redirect: 'Home'
    },
    // 首页
    {
      path: '/Home',
      name: 'Home',
      component: Home,
      meta: {
        title: '首页'
      }
      // children: [
      //   {
      //     path: '/Home',
      //     component: Info
      //   }
      // ]
    },
    // 产品列表
    {
      path: '/NewsList',
      name: 'NewsList',
      component: NewsList,
      meta: {
        title: '产品列表'
      }
    },
    // 产品详情
    {
      path: '/ProductDetail',
      name: 'ProductDetail',
      component: ProductDetail,
      meta: {
        title: '产品详情'
      }
    },
    // 确认订单
    {
      path: '/AffirmOrder',
      name: 'AffirmOrder',
      component: AffirmOrder,
      meta: { 
        // keepAlive: true 
        title: '确认订单'
      }
    },
    {
      path: '/Select',
      name: 'Select',
      component: Select,
      meta: {
        title: '选择'
      }
    },
    // 选择部门
    {
      path: '/SelectDep',
      name: 'SelectDep',
      component: SelectDep,
      meta: {
        title: '选择部门'
      }
    },
    // 搜索部门
    {
      path: '/SearchDep',
      name: 'SearchDep',
      component: SearchDep,
      meta: {
        title: '搜索部门'
      }
    },
    // 风险揭示书
    {
      path: '/RiskAnnounce',
      name: 'RiskAnnounce',
      component: RiskAnnounce,
      meta: {
        title: '风险揭示书'
      }
    },
    // 风险匹配
    {
      path: '/RiskMatch',
      name: 'RiskMatch',
      component: RiskMatch,
      meta: {
        title: '风险匹配'
      }
    },
    // 产品协议
    {
      path: '/ProductDeal',
      name: 'ProductDeal',
      component: ProductDeal,
      meta: {
        title: '产品协议'
      }
    },
    // 我的订单
    {
      path: '/MyOrder',
      name: 'MyOrder',
      component: MyOrder,
      meta: {
        title: '我的订单'
      }
    },
    // 订单详情
    {
      path: '/OrderDetail',
      name: 'OrderDetail',
      component: OrderDetail,
      meta: {
        title: '订单详情'
      }
    },
    // 修改联系方式
    {
      path: '/Modify',
      name: 'Modify',
      component: Modify,
      meta: {
        title: '修改联系方式'
      }
    },
    // 成功
    {
      path: '/Success',
      name: 'Success',
      component: Success,
      meta: {
        title: '提交成功'
      }
    },
    // 失败
    {
      path: '/Fail',
      name: 'Fail',
      component: Fail,
      meta: {
        title: '提交失败'
      }
    },
    // 刷新
    {
      path: '/Refresh',
      name: 'Refresh',
      component: Refresh,
      meta: {
        title: '刷新'
      }
    }
  ]
})
